import request from '@/utils/request'



// 获取考勤记录列表
export function listRecords(query) {
  return request({
    url: '/system/records/list',
    method: 'get',
    params: query
  })
}

// 查询考勤记录详细
export function getRecords(id) {
  return request({
    url: '/system/records/' + id,
    method: 'post'
  })
}

// 新增考勤记录
export function addRecords(data) {
  return request({
    url: '/system/records',
    method: 'post',
    data: data
  })
}

// 修改考勤记录
export function updateRecords(data) {
  return request({
    url: '/system/records',
    method: 'put',
    data: data
  })
}

// 删除考勤记录
export function delRecords(id) {
  return request({
    url: '/system/records/' + id,
    method: 'delete'
  })
}

//获取当日所有员工打卡记录
export function getTodayCheckInStats() {
  return request({
    url: '/system/records/todayCheckInStats',
    method: 'get'
  });
}


//根据员工id获取考勤记录
export function getMonthRecordsById(id) {
  return request({
    url: '/system/records/getMonthRecordsById/' + id,
    method: 'post'
  })
}
// 获取部门考勤统计数据
export function getDeptAttendanceStats(deptName) {
  return request({
    url: '/system/records/deptStats',
    method: 'get',
    params: { deptName }
  }).catch(error => {
    console.error('请求失败详情:', error.response); // 打印完整错误响应
  throw error;
});
}
